package com.example.myapplication2;

import android.annotation.SuppressLint;
import android.text.Layout;
import android.widget.LinearLayout;
import android.view.Gravity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
//import android.widget.*;  //编辑安卓界面出现“LinearLayout cannot be resolved to a type”，是由于未导入LinearLayout类，此类属于Android.widget包，所以可以在代码中加入“ import android.widget.*; ”

public class UC1activity extends AppCompatActivity {

    private Button shuiping,chuizhi,kaozuo,fanhui;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_uc1activity);

        shuiping = findViewById(R.id.shuiping);
        shuiping.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LinearLayout HL = findViewById(R.id.Ll_ll);
                if(HL.getOrientation() == LinearLayout.VERTICAL){
                    HL.setOrientation(LinearLayout.HORIZONTAL);
                }
            }
        });

        chuizhi = findViewById(R.id.chuizhi);
        chuizhi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LinearLayout Vl = findViewById(R.id.Ll_ll);
                if(Vl.getOrientation() == LinearLayout.HORIZONTAL){
                    Vl.setOrientation(LinearLayout.VERTICAL);
                }
            }
        });
        kaozuo = findViewById(R.id.kaozuo);
        kaozuo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LinearLayout Al = findViewById(R.id.Ll_Ll);
                Al.setGravity(Gravity.LEFT);
            }
        });
        fanhui = findViewById(R.id.fanhui);
        fanhui.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                //跳转到MainActicity界面
                Intent intent = new Intent(UC1activity.this,MainActivity.class);
                startActivity(intent);
            }
        });
        /*findViewById(R.id.button1).setOnClickListener(this);
        findViewById(R.id.button2).setOnClickListener(this);
        findViewById(R.id.button3).setOnClickListener(this);
*/
    }
}
